9763:LicenseGetAttribute should be able to retrieve all predefined attributes from a license
Test_MakeLicense(0, NULL)
Test_API_LicenseGetAttribute(NULL, 1 DRM_LICENSE_ATTRIB_VERSION, NORMAL, 2.0.0.0)
Test_API_LicenseGetAttribute(NULL, 2 DRM_LICENSE_ATTRIB_KID, NORMAL, QCl1EY0ISE2qXlCDaIMJ0A==)
Test_API_LicenseGetAttribute(NULL, 3 DRM_LICENSE_ATTRIB_LID, NORMAL, {00000507-0000-0010-8000-00AA006D2EA4})
Test_API_LicenseGetAttribute(NULL, 5 DRM_LICENSE_ATTRIB_ISSUEDATE, NORMAL, 20000102 23:20:14Z)
Test_API_LicenseGetAttribute(NULL, 6 DRM_LICENSE_ATTRIB_CONTENTPUBKEY, NORMAL, 7BZ*gTLq*LKyT3GcIWH8d5JkWiklMf7Aod!lhBgJpcTRu!chtojzMg==)
Test_API_LicenseGetAttribute(NULL, 9 DRM_LICENSE_ATTRIB_PRIORITY, NORMAL, 15)

9764:LicenseGetAttribute should be able to retrieve a non standard attribute from a license
Test_MakeLicense(0, <MyAttribute>My Value</MyAttribute>)
Test_API_LicenseGetAttribute(MyAttribute, 8 DRM_LICENSE_ATTRIB_OTHER, NORMAL, My Value)

9765:LicenseGetAttribute should return an error if the requested attribute does not exist in the license
Test_MakeLicense(0, NULL)
Test_API_LicenseGetAttribute(NoSuchAttribute, 8 DRM_LICENSE_ATTRIB_OTHER, NORMAL, NULL)=! 0 DRM_SUCCESS

9769:LicenseGetAttribute can retrieve meta attribute
Test_MakeLicense(0, <META><MyAttr>My Value</MyAttr></META>)
Test_API_LicenseGetAttribute(MyAttr, 7 DRM_LICENSE_ATTRIB_META_ATTRIBUTE, NORMAL, My Value)

9779:LicenseGetEvent should be able to retrieve the condition and action strings of an event
Test_MakeLicense(0, NULL)
Test_API_LicenseGetEvent(ONSTORE, NULL, NORMAL, NORMAL, 1, "!exists(secstate.MinAppSecLevel)?secstate.MinAppSecLevel=150:1")


9801:LicenseGetEnablingBits should return enabling bits in the license
Test_MakeLicense(0, NULL)
Test_API_LicenseGetEnablingBits(NORMAL, 1, NULL, NORMAL, NORMAL, NULL, NORMAL, NULL, NULL)

9803:LicenseGetEnablingBits should be able to return the enabling bits from a restored license
Test_MakeLicense(128 OP_LICGEN_RESTORE, NULL)
Test_API_LicenseGetEnablingBits(NORMAL, 1, NULL, NORMAL, NORMAL, NULL, NORMAL, NULL, NULL)

'9830:LicenseVerifyContentRevocation should verify a valid revocation string
'Test_MakeLicense(0, NULL)
'Test_API_LicenseGetContentRevocation(0, NULL, NORMAL, z4Jx7AKiY*tCKPGj8zJloMNuElScxMaQirsP4DBkNccc9eONPFbkSA==, NULL, NORMAL)
'Test_API_LicenseVerifyContentRevocation(NORMAL, NULL, NULL, NULL, NULL, NORMAL)

'9840:LicenseGetContentRevocation can obtain the first revocation string in the license
'Test_MakeLicense(8192 OP_LICGEN_CONTENT_REVOCATION_MULTIPLE, NULL)
'Test_API_LicenseGetContentRevocation(0, NULL, NORMAL, z4Jx7AKiY*tCKPGj8zJloMNuElScxMaQirsP4DBkNccc9eONPFbkSA==, NULL, NORMAL)
'Test_API_LicenseVerifyContentRevocation(NORMAL, NULL, 100, NULL, NULL, NORMAL)

10328:DRM_LIC_GetAttribute should retrieve uplinkKid from a leaf license
Test_SetTestKey(LICENSE_UPLINK_KID, myuplink)
Test_MakeLicense(0, NULL, 1 MAKE_LEAF_LICENSE)
Test_API_LicenseGetAttribute(NULL, 11 DRM_LICENSE_ATTRIB_CHAINEDKID, NORMAL, myuplink)

10329:DRM_LIC_GetEnablingBits should get the encrypted content key from a leaf license
Test_MakeLicense(0, NULL, 1 MAKE_LEAF_LICENSE)
Test_API_LicenseGetEnablingBits(NORMAL, 1, 2 eMSDRM_CK, NORMAL, NORMAL, NULL, NORMAL, NORMAL, NULL)

10330:DRM_LIC_GetEnablingBits should get the encrypted DES key from a root license
Test_MakeLicense(0, NULL, 2 MAKE_ROOT_LICENSE)
Test_API_LicenseGetEnablingBits(NORMAL, 1, 1 eMSDRM_PK, NORMAL, NORMAL, NULL, NORMAL, NORMAL, NULL)

10331:DRM_LIC_GetEnablingBits should get the encrypted DES key from a restored license
Test_MakeLicense(128 OP_LICGEN_RESTORE, NULL, 2 MAKE_ROOT_LICENSE)
Test_API_LicenseGetEnablingBits(NORMAL, 1, 1 eMSDRM_PK, NORMAL, NORMAL, NULL, NORMAL, NORMAL, NULL)

-------------------BVT ends here--------------------------

9766:LicenseGetAttribute allows '.' in attribute name
Test_MakeLicense(0, <My.Attribute.Name>My Dot Value</My.Attribute.Name>)
Test_API_LicenseGetAttribute(My.Attribute.Name, 8 DRM_LICENSE_ATTRIB_OTHER, NORMAL, My Dot Value)

9767:LicenseGetAttribute supports the xpath syntax on attribute name
Test_MakeLicense(0, <MyAttr><MyPath1>Path1</MyPath1><MyPath>My Path Value</MyPath></MyAttr>)
Test_API_LicenseGetAttribute(MyAttr/MyPath, 8 DRM_LICENSE_ATTRIB_OTHER, NORMAL, My Path Value)

9768:LicenseGetAttribute supports the xpath syntax on attribute name in metadata
Test_MakeLicense(0, <META><MyAttr><MyPath1>Path1</MyPath1><MyPath>My Path Value</MyPath></MyAttr></META>)
Test_API_LicenseGetAttribute(MyAttr/MyPath, 7 DRM_LICENSE_ATTRIB_META_ATTRIBUTE, NORMAL, My Path Value)

9770:LicenseGetAttribute should check null parameters
Test_MakeLicense(0, NULL)
Test_API_LicenseGetAttribute(NULL, MyAttr, 7 DRM_LICENSE_ATTRIB_META_ATTRIBUTE, NORMAL, NULL)=-2147024809(0X80070057, E_INVALIDARG)
Test_API_LicenseGetAttribute(NULL, 1 DRM_LICENSE_ATTRIB_VERSION, NULL, NULL)=-2147024809(0X80070057, E_INVALIDARG)

9771:LicenseGetAttribute should return an error if the license is not a valid xml string
Test_SetLicenseString(This is not a valid xml)
Test_API_LicenseGetAttribute(NULL, 1 DRM_LICENSE_ATTRIB_VERSION, NORMAL, NULL)=-2147172273(0X8004C04F, DRM_E_XMLNOTFOUND)

9772:LicenseGetAttribute should check bad combinations of parameters
Test_MakeLicense(0, <META><MyAttr>My Value</MyAttr></META>)
Test_API_LicenseGetAttribute(NULL, 7 DRM_LICENSE_ATTRIB_META_ATTRIBUTE, NORMAL, NULL)=-2147024809(0X80070057, E_INVALIDARG)
Test_API_LicenseGetAttribute(NULL, 8 DRM_LICENSE_ATTRIB_OTHER, NORMAL, NULL)=-2147024809(0X80070057, E_INVALIDARG)
Test_API_LicenseGetAttribute(NonNull, 1 DRM_LICENSE_ATTRIB_VERSION, NORMAL, NULL)=-2147024809(0X80070057, E_INVALIDARG)
Test_API_LicenseGetAttribute(NonNull, 2 DRM_LICENSE_ATTRIB_KID, NORMAL, NULL)=-2147024809(0X80070057, E_INVALIDARG)
Test_API_LicenseGetAttribute(NonNull, 3 DRM_LICENSE_ATTRIB_LID, NORMAL, NULL)=-2147024809(0X80070057, E_INVALIDARG)
Test_API_LicenseGetAttribute(NonNull, 4 DRM_LICENSE_ATTRIB_REVOCATION, NORMAL, NULL)=-2147172273(0X8004C04F, DRM_E_XMLNOTFOUND)
Test_API_LicenseGetAttribute(NonNull, 5 DRM_LICENSE_ATTRIB_ISSUEDATE, NORMAL, NULL)=-2147024809(0X80070057, E_INVALIDARG)
Test_API_LicenseGetAttribute(NonNull, 6 DRM_LICENSE_ATTRIB_CONTENTPUBKEY, NORMAL, NULL)=-2147024809(0X80070057, E_INVALIDARG)
Test_API_LicenseGetAttribute(NonNull, 9 DRM_LICENSE_ATTRIB_PRIORITY, NORMAL, NULL)=-2147024809(0X80070057, E_INVALIDARG)
Test_API_LicenseGetAttribute(EMPTY, 7 DRM_LICENSE_ATTRIB_META_ATTRIBUTE, NORMAL, NULL)=-2147024809(0X80070057, E_INVALIDARG)
Test_API_LicenseGetAttribute(EMPTY, 8 DRM_LICENSE_ATTRIB_OTHER, NORMAL, NULL)=-2147024809(0X80070057, E_INVALIDARG)

9777:LicenseGetEvent should be able to retrieve the condition string of an event
Test_MakeLicense(0, NULL)
Test_API_LicenseGetEvent(ONSELECT, NULL, NORMAL CONDITION, NULL, "(!exists(secstate.deleted) && (app.minseclevel >= 150?1:(secstate.drmreason=3;0)))", NULL)

9778:LicenseGetEvent should be able to retrieve the action string of an event
Test_MakeLicense(0, NULL)
Test_API_LicenseGetEvent(ONSTORE, NULL, NULL, NORMAL ACTION, NULL, "!exists(secstate.MinAppSecLevel)?secstate.MinAppSecLevel=150:1")

9780:LicenseGetEvent can retrieve info on specific type for the ONACTION event
Test_MakeLicense(0, NULL)
Test_API_LicenseGetEvent(ONACTION, Restore, NORMAL, NORMAL, 1, 2)

9781:LicenseGetEvent should return an error if the event does not exist in the license
Test_MakeLicense(0, NULL)
Test_API_LicenseGetEvent(ONCLOCKROLLBACK, NULL, NORMAL, NORMAL, NULL, NULL)=-2147172273(0X8004C04F, DRM_E_XMLNOTFOUND)

9911:LicenseGetEvent should return empty condition or action if the event does not have condition or action in the license
Test_MakeLicense(0, <ONDUMMY></ONDUMMY>)
Test_API_LicenseGetEvent(ONACTION, Play, NORMAL, NORMAL, 1, EMPTY)
Test_API_LicenseGetEvent(ONACTION, Backup, NORMAL, NORMAL, EMPTY, 1)
Test_API_LicenseGetEvent(ONDUMMY, NULL, NORMAL, NORMAL, EMPTY, EMPTY)

9799:LicenseGetEvent should check null parameters
Test_MakeLicense(0, NULL)
Test_API_LicenseGetEvent(NULL, ONACTION, Play, NULL, NULL, NULL, NULL)=-2147024809(0X80070057, E_INVALIDARG)
Test_API_LicenseGetEvent(NULL, Play, NULL, NULL, NULL, NULL)=-2147024809(0X80070057, E_INVALIDARG)

9800:LicenseGetEvent should return an error if the license is not a valid xml string
Test_SetLicenseString(This is not a valid xml)
Test_API_LicenseGetEvent(ONACTION, Play, NORMAL, NORMAL, NULL, NULL)=-2147172273(0X8004C04F, DRM_E_XMLNOTFOUND)

9804:LicenseGetEnablingBits should be able to get the algorithm string in enabling bits
Test_MakeLicense(0, NULL)
Test_API_LicenseGetEnablingBits(NORMAL, 1, 1 MSDRM, NORMAL, NORMAL, NULL, NORMAL, NULL, NULL)

9806:LicenseGetEnablingBits should check null parameters
Test_MakeLicense(0, NULL)
Test_API_LicenseGetEnablingBits(NULL, 1, NULL, NORMAL, NORMAL, NULL, NORMAL, NULL, NULL)=-2147024809(0X80070057, E_INVALIDARG)
Test_API_LicenseGetEnablingBits(NORMAL, 1, NULL, NULL, NORMAL, NULL, NORMAL, NULL, NULL)=-2147216893(0X80041203, LIC_PARAM_NOT_OPTIONAL)
Test_API_LicenseGetEnablingBits(NORMAL, 1, NULL, NORMAL, NULL, NULL, NORMAL, NULL, NULL)=-2147216893(0X80041203, LIC_PARAM_NOT_OPTIONAL)
Test_API_LicenseGetEnablingBits(NORMAL, 1, NULL, NORMAL, NORMAL, NULL, NULL, NULL, NULL)=-2147216893(0X80041203, LIC_PARAM_NOT_OPTIONAL)

'9807:LicenseGetEnablingBits should an error if the license if not a valid xml string

'9808:LicenseGetEnablingBits should return an error if the license does not have the enablingbits section

'9809:LicenseGetEnablingBits should return an error if the given buffer is too small

'9810:LicenseGetEnablingBits should return an error if the public key section is missing in the license

'9811:LicenseGetEnablingBits should return an error if the signature section is missing in the enablingbits section

9812:LicenseVerifySignature should verify a properly signed license
Test_MakeLicense(0, NULL)
Test_API_LicenseVerifySignature(NORMAL, NORMAL, 1)

9813:LicenseVerifySignature should verify a properly signed license with restore info
Test_MakeLicense(128 OP_LICGEN_RESTORE, NULL)
Test_API_LicenseVerifySignature(NORMAL, NORMAL, 1)

9814:LicenseVerifySignature should deny a license if its data is modified
Test_MakeLicense(3 OP_LICGEN_TAMPER_DATA, NULL)
Test_API_LicenseVerifySignature(NORMAL, NORMAL, 0)

9815:LicenseVerifySignature should deny a license if a bad restore info block is added to the license
Test_MakeLicense(147 OP_LICGEN_RESTORE|OP_LICGEN_TEST_RESTORE_SIGNATURE|OP_LICGEN_TAMPER_DATA, NULL)
Test_API_LicenseVerifySignature(NORMAL, NORMAL, 0)

9816:LicenseVerifySignature should deny a license with a bad signature even if the restore info is good
Test_MakeLicense(131 OP_LICGEN_RESTORE|OP_LICGEN_TAMPER_DATA, NULL)
Test_API_LicenseVerifySignature(NORMAL, NORMAL, 0)

9817:LicenseVerifySignature should deny a license if its signature section is missing
Test_MakeLicense(4 OP_LICGEN_MISSING_SIGNATURE, NULL)
Test_API_LicenseVerifySignature(NORMAL, NORMAL, 0)=-2147216889(0X80041207, LIC_UNSUPPORTED_VALUE)

9818:LicenseVerifySignature should return an error if the signature or hashing algorithm are not supported
Test_MakeLicense(1 OP_LICGEN_UNKNOWN_HASH_ALGORITHM, NULL)
Test_API_LicenseVerifySignature(NORMAL, NORMAL, 0)=-2147216889(0X80041207, LIC_UNSUPPORTED_VALUE)
Test_MakeLicense(2 OP_LICGEN_UNKNOWN_SIGN_ALGORITHM, NULL)
Test_API_LicenseVerifySignature(NORMAL, NORMAL, 0)=-2147216889(0X80041207, LIC_UNSUPPORTED_VALUE)

9819:LicenseVerifySignature should return an error if the signature or hashing algorithm attributes are missing
Test_MakeLicense(9 OP_LICGEN_MISSING_SIGN_ALGORITHM, NULL)
Test_API_LicenseVerifySignature(NORMAL, NORMAL, 0)=-2147216889(0X80041207, LIC_UNSUPPORTED_VALUE)
Test_MakeLicense(8 OP_LICGEN_MISSING_HASH_ALGORITHM, NULL)
Test_API_LicenseVerifySignature(NORMAL, NORMAL, 0)=-2147216889(0X80041207, LIC_UNSUPPORTED_VALUE)

9820:LicenseVerifySignature should return an error if the license has an incomplete restoreinfo section
Test_MakeLicense(384 OP_LICGEN_RESTORE|OP_LICGEN_EMPTY_RESTOREINFO, NULL)
Test_API_LicenseVerifySignature(NORMAL, NORMAL, 0)=-2147172273(0X8004C04F, DRM_E_XMLNOTFOUND)

Test_MakeLicense(148 OP_LICGEN_RESTORE|OP_LICGEN_TEST_RESTORE_SIGNATURE|OP_LICGEN_MISSING_SIGNATURE, NULL)
Test_API_LicenseVerifySignature(NORMAL, NORMAL, 0)=-2147172273(0X8004C04F, DRM_E_XMLNOTFOUND)

Test_MakeLicense(640 OP_LICGEN_RESTORE|OP_LICGEN_NO_RESTORE_LID, NULL)
Test_API_LicenseVerifySignature(NORMAL, NORMAL, 0)=-2147172273(0X8004C04F, DRM_E_XMLNOTFOUND)

9821:LicenseVerifySignature should return an error if the certchain is missing
Test_SetTestKey(LICENSE_SERVER_CERT_ROOT, NULL)
Test_SetTestKey(LICENSE_SERVER_CERT_LS, NULL)
Test_MakeLicense(0, NULL)
Test_API_LicenseVerifySignature(NORMAL, NORMAL, 0)=-2147216891(0x80041205, LIC_INVALID_LICENSE)

9823:LicenseVerifySignature should return an error if the LID in restoreinfo section does not match the LID in the license.
Test_MakeLicense(1152 OP_LICGEN_RESTORE|OP_LICGEN_TAMPER_RESTORE_LID, NULL)
Test_API_LicenseVerifySignature(NORMAL, NORMAL, 0)=-2147216891(0x80041205, LIC_INVALID_LICENSE)

9824:LicenseVerifyCertChain should verify valid certs if fCheckExpiry is true
Test_SetTestKeyByName(LICENSE_SERVER_SIGNINGKEY, LSPRVKEY)
Test_MakeLicense(0, NULL)
Test_API_LicenseVerifyCertChain(1 TRUE, NORMAL, NORMAL, 1)

9825:LicenseVerifyCertChain should verify expired certs if fCheckExpiry is false
Test_SetTestKeyByName(LICENSE_SERVER_SIGNINGKEY, LSPRVKEY)
' These are expired certs
Test_SetTestKeyByName(LICENSE_SERVER_CERT_ROOT, EXPIREDCERTROOT)
Test_SetTestKeyByName(LICENSE_SERVER_CERT_LS, EXPIREDCERTLS)
Test_MakeLicense(0, NULL)
Test_API_LicenseVerifyCertChain(0 FALSE, NORMAL, NORMAL, 1)

9826:LicenseVerifyCertChain should verify certchain section with more than 3 certs
Test_SetTestKeyByName(LICENSE_SERVER_CERT_LS0, CERT0)
Test_MakeLicense(0, NULL)
Test_API_LicenseVerifyCertChain(1 TRUE, NORMAL, NORMAL, 1)

9827:LicenseVerifyCertChain should deny expired certs if fCheckExpiry is true
Test_SetTestKeyByName(LICENSE_SERVER_SIGNINGKEY, LSPRVKEY)
' These are expired certs
Test_SetTestKeyByName(LICENSE_SERVER_CERT_ROOT, EXPIREDCERTROOT)
Test_SetTestKeyByName(LICENSE_SERVER_CERT_LS, EXPIREDCERTLS)
Test_MakeLicense(0, NULL)
Test_API_LicenseVerifyCertChain(1 TRUE, NORMAL, NORMAL, 0)=-2147184634(0X80049006, DRMUTIL_EXPIRED_CERT)

9828:LicenseVerifyCertChain should deny bad certs
Test_SetTestKey(LICENSE_SERVER_SIGNINGKEY, dsml2vSSmIIkNScihY5niY95fSQ=)
Test_SetTestKey(LICENSE_SERVER_CERT_ROOT, AAEAADgAAABHnuWu79pRyZdeXjZXr4JZk2xSEmij3MFnPjIXIwvHWZNKoouCVINgVWFIY4OXRRTFYhONF455W9o5!gbPlNB50yKXGyMeBnPkg*FGf1aaNxQECB8AAAAJAAAAAQAAAAE=)
Test_SetTestKey(LICENSE_SERVER_CERT_LS, AAEAADgAAAAc0PxXzxT372KnwUj4GAV4NszqN7TigP1iBVL!XpSor!osxfFC!U4i7BZ*gTLq*LKyT3GcIWH8d5JkWiklMf7Aod!lhBgJpcTRu!chtojzMhQEBRQAADQTAAAAAgAAbUM=)
Test_MakeLicense(0, NULL)
Test_API_LicenseVerifyCertChain(0 FALSE, NORMAL, NORMAL, 1)=-2147184633(0X80049007, DRMUTIL_INVALID_CERT)

9829:LicenseVerifyCertChain should return an error if the license does not contain the certificatechain section.
Test_SetTestKey(LICENSE_SERVER_CERT_ROOT, NULL)
Test_SetTestKey(LICENSE_SERVER_CERT_LS, NULL)
Test_MakeLicense(0, NULL)
Test_API_LicenseVerifyCertChain(1 TRUE, NORMAL, NORMAL, 0)=-2147216891(0X80041205, LIC_INVALID_LICENSE)
